package l2ft.gameserver.handler.admincommands.impl;

import java.util.StringTokenizer;

import l2ft.gameserver.handler.admincommands.IAdminCommandHandler;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.model.entity.events.fightclubmanager.FightClubEventManager;

public class AdminFightClub implements IAdminCommandHandler
{
	private static enum Commands
	{
		admin_fc_block_joining_rooms,
		admin_fc_block_joining_room,
		admin_fc_block_creating_rooms,
		admin_fc_block_starting_events,
		admin_fc_block_starting_event,
		admin_fc_destroy_existing_rooms,
		admin_fc_destroy_room,
		admin_fc_stop_all_rooms_tp_countdown,
		admin_fc_stop_room_tp_countdown,
		admin_fc_finish_all_events,
		admin_fc_finish_event,
		admin_fc_kick_from_event,
		admin_fc_end_event_round
	}

	@Override
	public boolean useAdminCommand(Enum comm, String[] wordList, String fullString, Player activeChar)
	{
		Commands command = (Commands) comm;

		if(!activeChar.getPlayerAccess().IsEventGm)
			return false;

		Player target;
		if(activeChar.getTarget() != null && activeChar.getTarget().isPlayer())
			target = activeChar.getTarget().getPlayer();
		else
			target = activeChar;
		
		StringTokenizer st = new StringTokenizer(fullString);
		st.nextToken();
		
		switch(command)
		{
			case admin_fc_block_joining_rooms:
				FightClubEventManager.getInstance().blockJoiningAllRooms(activeChar);
				break;
			case admin_fc_block_joining_room:
				FightClubEventManager.getInstance().blockJoiningRoom(activeChar, target);
				break;
			case admin_fc_block_creating_rooms:
				FightClubEventManager.getInstance().blockCreatingRooms(activeChar);
				break;
			case admin_fc_block_starting_events:
				FightClubEventManager.getInstance().blockStartingAllEvents(activeChar);
				break;
			case admin_fc_block_starting_event:
				FightClubEventManager.getInstance().blockStartingAllEvent(activeChar, target);
				break;
			case admin_fc_destroy_existing_rooms:
				FightClubEventManager.getInstance().destroyAllRooms(activeChar);
				break;
			case admin_fc_destroy_room:
				FightClubEventManager.getInstance().destroyRoom(activeChar, target);
				break;
			case admin_fc_stop_all_rooms_tp_countdown:
				FightClubEventManager.getInstance().stopAllRoomsCountdowns(activeChar);
				break;
			case admin_fc_stop_room_tp_countdown:
				FightClubEventManager.getInstance().stopRoomCountdown(activeChar, target);
				break;
			case admin_fc_finish_all_events:
				FightClubEventManager.getInstance().finishAllEvents(activeChar);
				break;
			case admin_fc_finish_event:
				FightClubEventManager.getInstance().finishEvent(activeChar, target);
				break;
			case admin_fc_kick_from_event:
				FightClubEventManager.getInstance().kickFromEvent(activeChar, target);
				break;
			case admin_fc_end_event_round:
				FightClubEventManager.getInstance().endEventRound(activeChar, target);
				break;
		}

		return true;
	}

	@Override
	public Enum[] getAdminCommandEnum()
	{
		return Commands.values();
	}
}